package com.loren.demo27.form.validate;

import com.loren.demo27.annotation.EnumValue;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Getter
@Setter
@ToString
public class TestForm {

    @NotNull
    private Long id;

    @NotBlank
    private String name;

    @NotNull
    @Min(1)
    @Max(100)
    private Integer age;

    @NotBlank
    @Length(min = 2, max = 20)
    private String remark;

    @NotBlank
    @EnumValue(strValues = {"admin", "user"})
    private String role;

    @Valid
    @NotNull
    private InnerForm inner;

}
